package com.heer.gymnasium.module.article.beans;

import com.heer.gymnasium.base.BaseBean;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by yan on 2018/1/16.
 * 文章实体类
 */

public class ArticleBean extends BaseBean {

    private String id;
    private String title;
    private String image;
    private String time;
    private String end_time;
    private String user_num;
    private String max_num;
    private String is_recommend;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getImage() {
        return image;
    }

    public void setImage(String image) {
        this.image = image;
    }

    public String getTime() {
        return time;
    }

    public void setTime(String time) {
        this.time = time;
    }

    public String getEnd_time() {
        return end_time;
    }

    public void setEnd_time(String end_time) {
        this.end_time = end_time;
    }

    public String getUser_num() {
        return user_num;
    }

    public void setUser_num(String user_num) {
        this.user_num = user_num;
    }

    public String getMax_num() {
        return max_num;
    }

    public void setMax_num(String max_num) {
        this.max_num = max_num;
    }

    public String getIs_recommend() {
        return is_recommend;
    }

    public void setIs_recommend(String is_recommend) {
        this.is_recommend = is_recommend;
    }

    //    数据转换
    public static List<ArticleBean> dataChange(List<ArticleResponseBean.Item> data) {
        List<ArticleBean> beanList = new ArrayList<>();

        if (data != null) {
            for (int i = 0; i < data.size(); i++) {
                ArticleBean bean = new ArticleBean();
                ArticleResponseBean.Item item = data.get(i);
                bean.setId(item.getId());
                bean.setTitle(item.getTitle());
                bean.setImage(item.getImage() == null ? "" : item.getImage().replace("\\",","));
                bean.setTime(item.getTime());
                bean.setEnd_time(item.getEnd_time());
                bean.setUser_num(item.getUser_num());
                bean.setMax_num(item.getMax_num());
                bean.setIs_recommend(item.getIs_recommend());
                beanList.add(bean);
            }
        }
        return beanList;
    }

}
